package org.example.DesignPatterns.Prototype;

/**
 * @description:
 * @author: farprt
 * @create: 2022-09-12 19:41
 **/
public class EnemyPlane implements ICloneable{

    private int x;
    private int y=0;
    private Bullet bullet=new Bullet();

    public EnemyPlane(int x){
        this.x=x;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void setBullet(Bullet bullet) {
        this.bullet = bullet;
    }

    public void fly(){
        y++;
    }

    @Override
    public EnemyPlane clone() throws CloneNotSupportedException {
        EnemyPlane clonePlane=(EnemyPlane)super.clone();
        clonePlane.setBullet(this.bullet.clone());
        return clonePlane;
    }
}